//
//  BaseService.h
//  NetTest
//
//  Created by mac on 12-5-10.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BaseModel.h"
#import <objc/objc.h>
#import <objc/runtime.h>
#import "Sqlite3Helper.h"

@interface BaseService : NSObject
{
    NSString* tablename_;
    NSString* tablePK_;
}

-(void)addModel:(BaseModel*)model;
-(void)updateModel:(BaseModel*)model;
-(bool)deleteModel:(NSString *)pkid;
-(bool)deleteAll;
//-(BaseModel*)getModel:(NSString *)pkid returnModel:(BaseModel*)model;
-(id)getModel:(NSString *)pkid returnClass:(Class)cls;
-(NSMutableArray*)getCollection:(NSString*)strWhere returnClass:(Class)cls;
- (NSMutableArray*)getCollection:(NSString *)strWhere orderby:(NSString *)orderby cls:(Class)cls;
-(NSMutableArray*)getCollection:(NSString *)strWhere orderby:(NSString *)orderby startIndex:(int)startIndex count:(int)count;
-(NSMutableArray*)getCollection:(NSString *)strWhere orderby:(NSString *)orderby startIndex:(int)startIndex count:(int)count cls:(Class)cls;
-(BOOL)isExist:(NSString*)pkid;

-(NSMutableArray*)getCollection:(NSString*)strWhere;
-(NSMutableArray*)getAll;
-(id)getModel:(NSString *)pkid;
-(int)getCountBystrwhere:(NSString*)strwhere;

@end
